<template>
  <j-dialog v-model="show" draggable width="90%" top="50px" title="兑付商品明细" :z-index="99">
    <div style="height: calc(100vh - 260px);">
      <div>
        <j-grid :columns="fieldsDetail" v-model="histList" :offset-height="100" />
      </div>
    </div>
  </j-dialog>
</template>
<script>
import tool from "@/utils/tool";

export default {
  name: "zcdflistdetail",
  data () {
    return {
      show: false,
      searchModel:{
        beginDate: '',
        endDate: '',
        buId:'',
        buName: '',
        brandId: '',
        brandName:'',
        invId: '',
        invName: ''
      },
      fields:[
        {type: 'index', width: 60},
        {title: '往来单位',width: 260, field: 'buName',align: 'left'},
        {title: '兑付日期',width: 110, field: 'billDate'},
        {title: '票据开始日期',width: 110, field: 'beginDate'},
        {title: '票据结束日期',width: 110, field: 'endDate'},
        {title: '兑付方式',width: 110, field: 'dfType'},
        {title: '收入账户',width: 110, field: 'accName'},
        {title: '品牌',width: 90, field: 'brandName',},
        {title: '商品',width: 200, field: 'invName',align: 'left'},
        {title: '兑付金额',width: 120, field: 'amount',formatter:'formatMoney',align: 'right',sum: true},
      ],
      histList: []
    }
  },
  computed: {
    fieldsDetail () {
      let f = [
        {type: 'index', width: 60,fixed: 'left'},
        {title: '商品名称',width: 200, field: 'invName',fixed: 'left',align: 'left'},
        {title: '品牌',width: 80, field: 'brandName'},
        {title: '规格',width: 70, field: 'spec'},
        {title: '单位',width: 70, field: 'unit'},
        {title: '兑付单价',width: 80, field: 'sendPrice',formatter:'formatMoney',align: 'right'},
        {title: '代赠',width: 80, field: 'dz',formatter:'formatMoney',align: 'right',sum: true},
        {title: '自赠',width: 80, field: 'zz',formatter:'formatMoney',align: 'right',sum: true},
        {title: '陈列',width: 80, field: 'cl',formatter:'formatMoney',align: 'right',sum: true},
        {title: '销量',width: 80, field: 'xl',formatter:'formatMoney',align: 'right',sum: true},
        {title: '合同',width: 80, field: 'ht',formatter:'formatMoney',align: 'right',sum: true},
        {title: '开业',width: 80, field: 'ky',formatter:'formatMoney',align: 'right',sum: true},
        {title: '赠饮',width: 80, field: 'zy',formatter:'formatMoney',align: 'right',sum: true},
        {title: '合计数量',width: 80, field: 'qty',formatter:'formatMoney',align: 'right',sum: true},
        {title: '兑付金额',width: 100, field: 'amount',formatter:'formatMoney',align: 'right',sum: true},
      ]
      return f
    }
  },
  methods: {
    open (row) {
      this.show = true
      this.getList(row)
    },
    getList (row) {
      tool.post('pay/zcdflistdetail', {id: row.id}).then(ret => {
        this.histList = ret.data.list
      })
    },
    detail (row) {
    }
  }
};
</script>
<style scoped lang="scss">

</style>